﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Practice_four
{
    public partial class Homework04 : Form
    {
        public Homework04()
        {
            InitializeComponent();
            cbx_01.Text = "+";
        }

        private void button1_Click(object sender, EventArgs e)
        {
            //获取文本值
            double Num01 = Convert.ToInt32(this.txt_01.Text);
            double Num02 = Convert.ToInt32(this.txt_02.Text);
            string Operator = this.cbx_01.Text;
            //计算
            switch (Operator) 
            {
                case "+":
                    txt_03.Text = Convert.ToString(Num01 + Num02);
                    break;
                case "-":
                    txt_03.Text = Convert.ToString(Num01 - Num02);
                    break;
                case "*":
                    txt_03.Text = Convert.ToString(Num01 * Num02);
                    break;
                default:
                    txt_03.Text = Convert.ToString(Num01 / Num02);
                    break;
            }
        }
    }
}
